//
//  SRSportShareViewController.m
//  SportRing
//
//  Created by icelee on 14-10-29.
//  Copyright (c) 2014年 HotOne. All rights reserved.
//

#import "SRSportShareViewController.h"
#import "UIView+Screenshot.h"
#import "SRMe+Cate.h"

@interface SRSportShareViewController ()

@property (nonatomic, weak)IBOutlet SRSportShareView *srSportShareView;

@end

@implementation SRSportShareViewController



- (void)viewDidLoad
{
    [super viewDidLoad];
    
    [self addBackButton];
    
    [self addRightImageButton:@"share_icon"];
    
    [self.srSportShareView showContentViewWithShareType:self.shareType];
    
    [self setupData];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self hideTabbar];
}

- (void)setHeaderData
{
    SRSportShareHeaderViewModel *model = [[SRSportShareHeaderViewModel alloc] init];
    
    if (self.shareType == SR_SHARE_TYPE_MONTH_SPORT ||self.shareType == SR_SHARE_TYPE_MONTH_SLEEPING)
    {
        model.date = [NSDate stringFromDate:_date format:@"MM月"];
        
    }
    else
    {
        model.date = [NSDate stringFromDate:_date format:@"MM月dd日"];
        
    }
    model.name = [SRMe currentUser].nickName;
    model.headerImage = @"";
    [self.srSportShareView setHeaderDataWithHeaderModel:model];
}

- (void)setSRSportShareContentForMonthViewData:(SRSportShareContentForMonthViewModel *)model
{
    [self.srSportShareView setSRSportShareContentForMonthViewData:model];
}

- (void)setSRSleepingShareContentViewData:(SRSleepingShareContentViewModel *)model
{
    [self.srSportShareView setSRSleepingShareContentViewData:model];

}

- (void)setSRSportShareContentForDayViewData:(SRSportShareContentForDayViewModel *)model
{
    [self.srSportShareView setSRSportShareContentForDayViewData:model];

}

- (void)setupData
{
    [self setHeaderData];
    
    [self setSRSportShareContentForMonthViewData:_monthShareData];
    
    [self setSRSleepingShareContentViewData:_sleepingShareData];
    
    [self setSRSportShareContentForDayViewData:_dayShareData];


}

-(void)onRightButtonPressed
{
    [SRShare setup];//shareSDK初始化
    [SRShare shareWithContent:@"IMCO（爱魔客）" image:[self.view screenshot:NO]];
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
